#include "const.h"

const char *s_getdir(char *buf, size_t n, const char *filename) {
	const char *p;

	if ((p = strrchr(filename, '/')) != (const char *)0) {
		i_strncpy(buf, n, filename, (p-filename) + 1);
		return &p[1];
	}

	*buf = 0;
	return filename;
}
